package com.techfied.hex;

import java.util.LinkedList;

public class FIFO<T extends Cell> extends LinkedList<T> {
	
	public int size = 0;
	public FIFO(int size){
		this.size = size;
	}
	
	@Override
	public boolean add(T e) {
		if(this.size() == size){
			this.removeFirst();
		}
		return super.add(e);
	};
	
	@Override
	public void addFirst(T e) {
		if(this.size() == size){
			this.removeLast();
		}
		super.addFirst(e);
	};
}
